<template>
    <div>
        <el-dialog title="文件办理状态" :visible.sync="detailsVisible" width='450px' append-to-body v-dialogDrag :close-on-click-modal="false" >
            <div>
                <el-form ref="rowdata" :model="rowdata" label-width="100px" class="personeditform" :rules="rules" status-icon>
                    <el-form-item label="文件名称" >
                        <el-input v-model="rowdata.name" style="width: 80%;" :disabled="true"></el-input>
                    </el-form-item>
                    <el-form-item label="文件编号" >
                        <el-input v-model="rowdata.bianhao" style="width: 80%;" :disabled="true"></el-input>
                    </el-form-item>
                    <el-form-item label="文件序号" >
                        <el-input v-model="rowdata.recoderfile" style="width: 80%;" :disabled="true"></el-input>
                    </el-form-item>
                    <el-form-item label="办理状态" prop="status">
                        <el-select v-model="rowdata.status" >
                            <el-option label="未办" value="未办"></el-option>
                            <el-option label="待办" value="待办"></el-option>
                            <el-option label="已办" value="已办"></el-option>
                        </el-select>
                    </el-form-item>
                </el-form>
                <el-row style="position: relative;width: 100%;">
                    <el-button style="margin: 0 auto;display: block;"   type="primary" @click="checksubmit('rowdata')">确定并保存<i class="el-icon-upload el-icon--right" ></i></el-button>
                </el-row>
            </div>
        </el-dialog>
        
    </div>
</template>
<script>
    import {mapActions} from 'vuex';
    export default {
        data() {
            return { 
                detailsVisible: false, 
                needZk:true,
                rowdata: {
                    name:'',
                    bianhao:'',
                    recoderfile:'',
                    status:''
                },
                rules: {
                    status: [{ required: true, message: '不能为空', trigger: 'change' }],
                },
            };
        },
       
        mounted() {       
        },
        components: {

        },
        methods: {
            checksubmit(formName){
                console.log(this.rowdata);
                this.$refs[formName].validate((valid) => {
                    if (valid) {
                        this.uploadAjax();
                    } 
                    else {
                        this.$message("请填写必要信息");
                        return false;
                    }
                });
            },
            uploadAjax(){
                let _this=this;
                let postdata={
                    type:"changerecoderstatus",
                    split:JSON.stringify(this.rowdata)
                }
                this.$Common.AjaxPost(postdata,true)
                .then(function(e){
                    _this.$message("操作成功");
                    _this.detailsVisible=false;
                    _this.$emit('editResult');
                },function(){
                     _this.$message("操作失败");
                })
                .catch(function(reason) {
                    console.log('catch:', reason);
                });
            },
        },

    }
</script>
<style>
</style>